# Copyright (C) 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")

go_library(
    name = "go_default_library",
    srcs = [
        "api.go",
        "cmd.go",
        "cmd_convert.go",
        "cmd_errors.go",
        "cmd_extras.go",
        "cmd_flags.go",
        "cmd_foreach.go",
        "cmd_id.go",
        "cmd_id_group.go",
        "cmd_id_range.go",
        "cmd_id_set.go",
        "cmd_observations.go",
        "data_group.go",
        "doc.go",
        "graph_visualization.go",
        "handle.go",
        "labeled.go",
        "memory_breakdown.go",
        "mesh.go",
        "pipeline.go",
        "property.go",
        "reference.go",
        "resource.go",
        "service.go",
        "state.go",
        "subcmd_idx.go",
        "subcmd_idx_trie.go",
        "texture.go",
        "watcher.go",
    ],
    embed = [":api_go_proto"],
    importpath = "github.com/google/gapid/gapis/api",
    visibility = ["//visibility:public"],
    deps = [
        "//core/app/status:go_default_library",
        "//core/context/keys:go_default_library",
        "//core/data/binary:go_default_library",
        "//core/data/compare:go_default_library",
        "//core/data/deep:go_default_library",
        "//core/data/endian:go_default_library",
        "//core/data/generic:go_default_library",
        "//core/data/id:go_default_library",
        "//core/data/pod:go_default_library",
        "//core/data/protoconv:go_default_library",
        "//core/data/protoutil:go_default_library",
        "//core/data/slice:go_default_library",
        "//core/event/task:go_default_library",
        "//core/fault:go_default_library",
        "//core/image:go_default_library",
        "//core/log:go_default_library",
        "//core/math/f32:go_default_library",
        "//core/math/interval:go_default_library",
        "//core/math/sint:go_default_library",
        "//core/os/device:go_default_library",
        "//core/stream:go_default_library",
        "//core/stream/fmts:go_default_library",
        "//gapil/constset:go_default_library",
        "//gapis/database:go_default_library",
        "//gapis/memory:go_default_library",
        "//gapis/memory/memory_pb:go_default_library",
        "//gapis/replay/builder:go_default_library",
        "//gapis/replay/value:go_default_library",
        "//gapis/service/path:go_default_library",
        "//gapis/stringtable:go_default_library",
        "//gapis/vertex:go_default_library",
        "@com_github_golang_protobuf//proto:go_default_library",
        "@com_github_pkg_errors//:go_default_library",
    ],
)

go_test(
    name = "go_default_test",
    srcs = [
        "cmd_id_group_test.go",
        "graph_visualization_test.go",
        "subcmd_idx_test.go",
        "subcmd_idx_trie_test.go",
    ],
    embed = [":go_default_library"],
    deps = [
        "//core/assert:go_default_library",
        "//core/data/slice:go_default_library",
        "//core/fault:go_default_library",
        "//core/log:go_default_library",
    ],
)

proto_library(
    name = "api_proto",
    srcs = [
        "gfxtrace.proto",
        "service.proto",
    ],
    visibility = ["//visibility:public"],
    deps = [
        "//core/data/pod:pod_proto",
        "//core/image:image_proto",
        "//gapis/service/box:box_proto",
        "//gapis/service/path:path_proto",
        "//gapis/vertex:vertex_proto",
    ],
)

cc_proto_library(
    name = "api_cc_proto",
    visibility = ["//visibility:public"],
    deps = [":api_proto"],
)

go_proto_library(
    name = "api_go_proto",
    importpath = "github.com/google/gapid/gapis/api",
    proto = ":api_proto",
    visibility = ["//visibility:public"],
    deps = [
        "//core/data/pod:go_default_library",
        "//core/image:go_default_library",
        "//gapis/service/box:go_default_library",
        "//gapis/service/path:go_default_library",
        "//gapis/vertex:go_default_library",
    ],
)

java_proto_library(
    name = "api_java_proto",
    visibility = ["//visibility:public"],
    deps = [":api_proto"],
)
